package com.amado.course37CharStream;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;

/**
 * 字符流
 * @author Administrator
 *
 */
public class S05StringReaderTest {
	public static void main(String[] args) throws IOException {
		
		Reader reader = new StringReader("床前明月光，疑是地上霜，举头望明月，低头思故乡。");
		StringBuffer buffer = new StringBuffer();
		try {
			char[] charArray = new char[6];
			int bytes = 0;
			while (( bytes = reader.read(charArray))!=-1) {
				buffer.append(charArray);
			}
		} finally {
			reader.close();
		}
		System.out.println(buffer);
	}
}
